package com.cloud.observer.example;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * @author: create by God of SJF
 * @version: v1.0
 * @description: com.cloud.observer.example
 * @date:2021/7/28
 */

@Component
public class XxlJobTest {


    @XxlJob("TestHandler")
    public ReturnT<String> demoJobHandler(String param) throws Exception {
//        XxlJobLogger.log("XXL-JOB, Hello World.");

        for (int i = 0; i < 5; i++) {
//            XxlJobLogger.log("beat at:" + i);
            System.out.println(new Date()+",XXLJOB");
            TimeUnit.SECONDS.sleep(2);
        }
        return ReturnT.SUCCESS;
    }
}
